package 反射第一遍.demo14;

import java.lang.reflect.Method;

/**
 * @author wql
 * @version 1.0
 * @date 2022/10/27 15:08
 */

public class Test {
    public static void main(String[] args)throws Exception {
        Class<rose> roseClass = rose.class;
        Method sting = roseClass.getDeclaredMethod("sting");
        System.out.println("sting = " + sting);
        Method eat = roseClass.getDeclaredMethod("eat", String.class, Integer.class);
        System.out.println("eat = " + eat);

        Method[] methods = roseClass.getDeclaredMethods();
        for (Method method : methods) {
            System.out.println("method = " + method);
        }

        Method show = roseClass.getMethod("show");
        System.out.println("show = " + show);

        Method[] methods1 = roseClass.getMethods();
        for (Method method : methods1) {
            System.out.println(method);
        }

    }
}
class  flower{
    public void show(){
        System.out.println("花儿的show");
    }
    public void print(){
        System.out.println("花儿的print");
    }
}
class rose extends flower{
    public void sting(){
        System.out.println("玫瑰的sting");
    }
    public void eat(String name,Integer num){
        System.out.println("玫瑰的eat"+num);
    }
}

